Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncated-Normal Operation #1015

Merged
merged 4 commits into from
Jun 12, 2021
Merged

Conversation

AzizZayed
Copy link
Contributor

Description

The same as #1005 but for other engines.

@@ -156,7 +158,20 @@ public NDArray randomNormal(float loc, float scale, Shape shape, DataType dataTy
/** {@inheritDoc} */
@Override
public NDArray truncatedNormal(float loc, float scale, Shape shape, DataType dataType) {
throw new UnsupportedOperationException("Not supported!");
Random random = new Random();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use RandomUtils.

@@ -13,11 +13,13 @@
package ai.djl.ndarray;

import ai.djl.Device;
import ai.djl.ndarray.internal.NDArrayEx;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused imports

@codecov-commenter
Copy link

codecov-commenter commented Jun 12, 2021

Codecov Report

Merging #1015 (2b1c526) into master (77809f4) will increase coverage by 0.06%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1015      +/-   ##
============================================
+ Coverage     69.97%   70.03%   +0.06%     
- Complexity     5106     5111       +5     
============================================
  Files           504      504              
  Lines         22601    22616      +15     
  Branches       2367     2369       +2     
============================================
+ Hits          15815    15840      +25     
+ Misses         5519     5513       -6     
+ Partials       1267     1263       -4     
Impacted Files Coverage Δ
...pi/src/main/java/ai/djl/ndarray/BaseNDManager.java 50.00% <0.00%> (-3.47%) ⬇️
api/src/main/java/ai/djl/Device.java 65.95% <0.00%> (-4.26%) ⬇️
...rc/main/java/ai/djl/ndarray/internal/NDFormat.java 83.90% <0.00%> (-1.15%) ⬇️
api/src/main/java/ai/djl/ndarray/NDArray.java 73.25% <0.00%> (-0.43%) ⬇️
...src/main/java/ai/djl/pytorch/engine/PtNDArray.java 79.75% <0.00%> (-0.15%) ⬇️
...ne/src/main/java/ai/djl/mxnet/jna/StringArray.java 92.85% <0.00%> (ø)
...e/src/main/java/ai/djl/mxnet/jna/PointerArray.java 94.11% <0.00%> (ø)
...ine/src/main/java/ai/djl/pytorch/jni/JniUtils.java 90.64% <0.00%> (+0.07%) ⬆️
...ain/java/ai/djl/modality/cv/util/NDImageUtils.java 64.47% <0.00%> (+1.31%) ⬆️
api/src/main/java/ai/djl/repository/Artifact.java 93.10% <0.00%> (+1.72%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77809f4...2b1c526. Read the comment docs.

@frankfliu frankfliu merged commit 9d994a2 into deepjavalibrary:master Jun 12, 2021
dist[i] = sample;
}

return create(dist).addi(loc).muli(scale).reshape(shape).toType(dataType, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AzizZayed I think you need to multiply before you add. Otherwise, it will scale the addition too.

AzizZayed added a commit to AzizZayed/djl that referenced this pull request Jun 14, 2021
Truncated-Normal Operation

Truncated-Normal Operation (deepjavalibrary#1015)

* [tensoflow] Add truncated normal operation

* Add truncated-normal to all engines that do not support it

* Truncated-Normal Operation
frankfliu pushed a commit that referenced this pull request Jun 15, 2021
* [tensoflow] Add truncated normal operation

* Add truncated-normal to all engines that do not support it

Truncated-Normal Operation

Truncated-Normal Operation (#1015)

* [tensoflow] Add truncated normal operation

* Add truncated-normal to all engines that do not support it

* Truncated-Normal Operation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants